home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 003 / db3tips3.arc / DB3PSET.TXT < prev    next >
Encoding:
Text File  |  1986-12-21  |  2.3 KB  |  57 lines

  1.                           PSET in dBASE
  2.        (PC Magazine Vol 5 No 16 Sept 30, 1986 Power User)
  3.  
  4.      PSET.COM (PC Magazine Vol 5 No 8 April 29, 1986 Power User) is
  5. translated into dBASE.  PSET.PRG can be called from the dot prompt or
  6. directly from a program, and the syntax is the same as for PSET.COM,
  7. with one exception: in dBASE, the control codes are passed as a
  8. parameter, so they must be enclosed in quotes.  For example, the
  9. sequence ESC E ESC G sets an Epson to print double-strike/emphasized.
  10. To send this command in dBASE, you use:
  11.  
  12. . do pset with "27 69 27 71"
  13.  
  14. The control codes are accepted by the printer without moving the
  15. printhead, so you can change type sizes or enhancements on the same
  16. print line -- up to dBASE's built-in limitation of 264 characters per
  17. command line.  The CONSOLE is SET OFF so the proceedings don't muddle
  18. up your screen with that screwball crew of characters under CHR(32)!
  19.      Editor's Note:  It's handier to call PSET.PRG than to RUN PSET.COM
  20. even if you have the memory available.  It's faster, too.  The line
  21. "pset=incoming" was added, so the incoming parameter doesn't get eaten
  22. in the DO WHILE loop.  So, for example, you could:
  23.  
  24. . STOR "27 69 27 71" to dublbold
  25. . DO PSET WITH dublbold
  26.  
  27. Notice that if you're passing a memory variable as the parameter,
  28. don't enclose it in quotes.  If you do, PSET will dutifully shout
  29. CHR(dublbold) at your printer and -- worse -- your printer will hear!
  30.      There's a lot you can build onto PSET if you want to.  You could
  31. STORE complete sets of parameters at the beginning of a program or in
  32. a procedure file.  Or you could save them in a .MEM file, RESTORing
  33. them as needed.  This is useful if you often switch between printers.
  34.  
  35. *** PSET.PRG - Sends control codes to a printer
  36. PRIV incoming,pset,loc,seg
  37. PARA incoming
  38. SET CONS OFF
  39. pset=incoming
  40. DO WHIL " "$pset
  41.   loc=AT(" ",pset)
  42.   seg="CHR("+SUBS(pset,1,loc-1)+")"
  43.   SET PRIN ON
  44.   ?? &seg
  45.   SET PRIN OFF
  46.   pset=SUBS(pset,loc+1)
  47. ENDDO
  48. seg="CHR("+pset+")"
  49. SET PRIN ON
  50. ?? &seg
  51. SET PRIN OFF
  52. SET CONS ON
  53. RETU
  54. * Incoming parameter uses the space as delimiter
  55. * Printer must be online
  56.  
  57.